package _05多线程实现多人同时上传;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class UploadServer {
    public static void main(String[] args) throws IOException {
        System.out.println("服务器端启动");

        //创建服务器socket对象,指定端口
        ServerSocket serverSocket = new ServerSocket(8888);
        final ExecutorService pool = Executors.newFixedThreadPool(100);
        while (true){
            Socket socket = serverSocket.accept();
            //new UploadThread(socket).start();//多线程
            pool.submit(new UploadRunnable(socket));//线程池
        }

    }
}
